const { override, fixBabelImports, addLessLoader, addPostcssPlugins, addWebpackAlias } = require('customize-cra');
const theme = require("./src/antd-theme.json")
const px2rem = require("postcss-px2rem-exclude") 
const path = require('path')
const resolveAlias = dir => path.join(__dirname, '.', dir)
console.log(resolveAlias('src'))
console.log(path.appSrc)
module.exports = override(
    addWebpackAlias({
      '@': resolveAlias('src'),
    }),
    addLessLoader({
      lessOptions:{ 
        javascriptEnabled: true,
        modifyVars: theme ,
      } 
    }),
    addPostcssPlugins([px2rem({ rootValue: 75, propList: ['*'], minPixelValue: 2, selectorBlackList: ['am-'] })]),

    fixBabelImports('import', {
      libraryName: 'antd-mobile',
      libraryDirectory: 'es',
      style: true,
    }),
);